-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v2] feat(pagination): add async pagination #2464
Conversation
6130c15
to
cfe56a4
Compare
cfe56a4
to
7c3f1d7
Compare
Rebased. v2's tests are currently failing and now this branch will too :D |
Nice work @TheSharpieOne, you're all over it. @JedWatson let me know if you need any help maintaining this package. |
73b7d1f
to
072aeb2
Compare
When this will be merged? :) |
Would love to see this merged as soon as possible! |
+1 |
My company is using a fork of |
Just FYI my changes have been published to @thesharpieone/react-select-async-pagination Also, the Async component is pretty simple (mostly managing cache and calling a user defined function to get the options), this could definitely be a third-party package which uses react-select under the hood so that this feature doesn't need to be in the "core" package. |
@TheSharpieOne Is there any chance this gets merged soon? It's a nice feature I would like to use in my project. |
@jelteliekens it's not up to me. |
Can't wait :3 |
+1 |
I just want to know the main reason behind blocking this PR? |
Just like #1237, but for v2.
This adds a new
pagination
prop to theSelect.Aync
component. It is a boolean which isfalse
by default (false
: things act as they did before it was added). Whenpagination
istrue
loadOptions
is given an additional argument;page
.page
tells the user'sloadOptions
function which page to load (they can use to when building their request). Additional page results are appended to the options list. Changing the input value will reset the page back to1
.loadOptions
is called when the user scrolls to the bottom of the menu list, trigger the next page of results to be appended.Caching is used! (Cache all the things!). If a user scrolls down enough to load additional pages, then changes the input (triggering new requests), then enters the original input, all of the pages for the original input will be loaded back and when the user scroll to the bottom again, it will pick up on the page it left off on.